import java.util.ArrayList;
import java.util.Hashtable;

public class QTable {
	
	private Hashtable<Vertex, Hashtable<Edge, Float>> table;
	
	public QTable(ArrayList<Vertex> V) {
		
		table = new Hashtable<Vertex, Hashtable<Edge, Float>>();
		
		for (Vertex v : V) {
			Hashtable<Edge, Float> h = new Hashtable<Edge, Float>();
			for (Edge e : v.getOutEdges()) {
				h.put(e, 0.0f);
			}
			table.put(v, h);
		}
		
	}
	
	public float getQValue(Vertex s, Edge a) {
		return table.get(s).get(a);
	}
	
	public void setQValue(Vertex s, Edge a, float q) {
		table.get(s).put(a, q);
	}
	
	public void print() {
		for (Vertex v : table.keySet()) {
			for (Edge e : table.get(v).keySet()) {
				System.out.println("Q("+v+","+e.getTo()+")="+table.get(v).get(e));
			}
		}
	}
	
}
